

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>mClock Config Reference &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="BlueStore 配置参考" href="../bluestore-config-ref/" />
    <link rel="prev" title="OSD 配置参考" href="../osd-config-ref/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">Ceph 存储集群</a> &raquo;</li>
        
          <li><a href="../">配置</a> &raquo;</li>
        
      <li>mClock Config Reference</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/rados/configuration/mclock-config-ref.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../">配置</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../storage-devices/">存储设备</a></li>
<li class="toctree-l3"><a class="reference internal" href="../ceph-conf/">配置 Ceph</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/">通用选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-network-config">网络</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#id3">监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-osd-config">认证</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#osds">OSDs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#id5">心跳</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-logging-and-debugging">日志记录、调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-conf">ceph.conf 实例</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-runtime-config">跑多个集群（已废弃）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network-config-ref/">网络选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../msgr2/">信使协议 v2</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auth-config-ref/">认证选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-config-ref/">监视器选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-lookup-dns/">通过 DNS 查询监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-osd-interaction/">心跳选项（监视器与 OSD 的的交互）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd-config-ref/">OSD 选项</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">DmClock 配置</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#mclock-profiles-definition-and-purpose">mClock Profiles - Definition and Purpose</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mclock-profile-types">mClock Profile Types</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mclock-built-in-profiles">mClock Built-in Profiles</a></li>
<li class="toctree-l4"><a class="reference internal" href="#steps-to-enable-mclock-profile">Steps to Enable mClock Profile</a></li>
<li class="toctree-l4"><a class="reference internal" href="#osd-capacity-determination-automated">OSD Capacity Determination (Automated)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#steps-to-manually-benchmark-an-osd-optional">Steps to Manually Benchmark an OSD (Optional)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mclock-config-options">mClock Config Options</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-config-ref/">BlueStore 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../filestore-config-ref/">FileStore 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../journal-ref/">日志选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pool-pg-config-ref/">存储池、归置组和 CRUSH 选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../general-config-ref/">常规选项</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../operations/">运维</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="mclock-config-reference">
<h1>mClock Config Reference<a class="headerlink" href="#mclock-config-reference" title="Permalink to this headline">¶</a></h1>
<p id="index-0">Mclock profiles mask the low level details from users, making it
easier for them to configure mclock.</p>
<p>The following input parameters are required for a mclock profile to configure
the QoS related parameters:</p>
<ul class="simple">
<li><p>total capacity (IOPS) of each OSD (determined automatically)</p></li>
<li><p>an mclock profile type to enable</p></li>
</ul>
<p>Using the settings in the specified profile, the OSD determines and applies the
lower-level mclock and Ceph parameters. The parameters applied by the mclock
profile make it possible to tune the QoS between client I/O, recovery/backfill
operations, and other background operations (for example, scrub, snap trim, and
PG deletion). These background activities are considered best-effort internal
clients of Ceph.</p>
<div class="section" id="mclock-profiles-definition-and-purpose">
<span id="index-1"></span><h2>mClock Profiles - Definition and Purpose<a class="headerlink" href="#mclock-profiles-definition-and-purpose" title="Permalink to this headline">¶</a></h2>
<p>A mclock profile is <em>“a configuration setting that when applied on a running
Ceph cluster enables the throttling of the operations(IOPS) belonging to
different client classes (background recovery, scrub, snaptrim, client op,
osd subop)”</em>.</p>
<p>The mclock profile uses the capacity limits and the mclock profile type selected
by the user to determine the low-level mclock resource control parameters.</p>
<p>Depending on the profile type, lower-level mclock resource-control parameters
and some Ceph-configuration parameters are transparently applied.</p>
<p>The low-level mclock resource control parameters are the <em>reservation</em>,
<em>limit</em>, and <em>weight</em> that provide control of the resource shares, as
described in the <a class="reference internal" href="../osd-config-ref/#dmclock-qos"><span class="std std-ref">基于 mClock 的 QoS</span></a> section.</p>
</div>
<div class="section" id="mclock-profile-types">
<span id="index-2"></span><h2>mClock Profile Types<a class="headerlink" href="#mclock-profile-types" title="Permalink to this headline">¶</a></h2>
<p>mclock profiles can be broadly classified into two types,</p>
<ul class="simple">
<li><p><strong>Built-in</strong>: Users can choose between the following built-in profile types:</p>
<ul>
<li><p><strong>high_client_ops</strong> (<em>default</em>):
This profile allocates more reservation and limit to external-client ops
as compared to background recoveries and other internal clients within
Ceph. This profile is enabled by default.</p></li>
<li><p><strong>high_recovery_ops</strong>:
This profile allocates more reservation to background recoveries as
compared to external clients and other internal clients within Ceph. For
example, an admin may enable this profile temporarily to speed-up background
recoveries during non-peak hours.</p></li>
<li><p><strong>balanced</strong>:
This profile allocates equal reservation to client ops and background
recovery ops.</p></li>
</ul>
</li>
<li><p><strong>Custom</strong>: This profile gives users complete control over all the mclock
configuration parameters. Using this profile is not recommended without
a deep understanding of mclock and related Ceph-configuration options.</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Across the built-in profiles, internal clients of mclock (for example
“scrub”, “snap trim”, and “pg deletion”) are given slightly lower
reservations, but higher weight and no limit. This ensures that
these operations are able to complete quickly if there are no other
competing services.</p>
</div>
</div>
<div class="section" id="mclock-built-in-profiles">
<span id="index-3"></span><h2>mClock Built-in Profiles<a class="headerlink" href="#mclock-built-in-profiles" title="Permalink to this headline">¶</a></h2>
<p>When a built-in profile is enabled, the mClock scheduler calculates the low
level mclock parameters [<em>reservation</em>, <em>weight</em>, <em>limit</em>] based on the profile
enabled for each client type. The mclock parameters are calculated based on
the max OSD capacity provided beforehand. As a result, the following mclock
config parameters cannot be modified when using any of the built-in profiles:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_client_res"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_client_res</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_client_wgt"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_client_wgt</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_client_lim"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_client_lim</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_background_recovery_res"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_background_recovery_res</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_background_recovery_wgt"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_background_recovery_wgt</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_background_recovery_lim"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_background_recovery_lim</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_background_best_effort_res"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_background_best_effort_res</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_background_best_effort_wgt"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_background_best_effort_wgt</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_mclock_scheduler_background_best_effort_lim"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_scheduler_background_best_effort_lim</span></code></a></p></li>
</ul>
<p>The following Ceph options will not be modifiable by the user:</p>
<ul class="simple">
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_max_backfills"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_max_backfills</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_recovery_max_active"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_max_active</span></code></a></p></li>
</ul>
<p>This is because the above options are internally modified by the mclock
scheduler in order to maximize the impact of the set profile.</p>
<p>By default, the <em>high_client_ops</em> profile is enabled to ensure that a larger
chunk of the bandwidth allocation goes to client ops. Background recovery ops
are given lower allocation (and therefore take a longer time to complete). But
there might be instances that necessitate giving higher allocations to either
client ops or recovery ops. In order to deal with such a situation, you can
enable one of the alternate built-in profiles by following the steps mentioned
in the next section.</p>
<p>If any mClock profile (including “custom”) is active, the following Ceph config
sleep options will be disabled,</p>
<ul class="simple">
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_recovery_sleep"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_sleep</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_recovery_sleep_hdd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_sleep_hdd</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_recovery_sleep_ssd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_sleep_ssd</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_recovery_sleep_hybrid"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_recovery_sleep_hybrid</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_scrub_sleep"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_scrub_sleep</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_delete_sleep"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_delete_sleep</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_delete_sleep_hdd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_delete_sleep_hdd</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_delete_sleep_ssd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_delete_sleep_ssd</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_delete_sleep_hybrid"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_delete_sleep_hybrid</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_snap_trim_sleep"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_snap_trim_sleep</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_snap_trim_sleep_hdd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_snap_trim_sleep_hdd</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_snap_trim_sleep_ssd"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_snap_trim_sleep_ssd</span></code></a></p></li>
<li><p><a class="reference internal" href="../osd-config-ref/#confval-osd_snap_trim_sleep_hybrid"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_snap_trim_sleep_hybrid</span></code></a></p></li>
</ul>
<p>The above sleep options are disabled to ensure that mclock scheduler is able to
determine when to pick the next op from its operation queue and transfer it to
the operation sequencer. This results in the desired QoS being provided across
all its clients.</p>
</div>
<div class="section" id="steps-to-enable-mclock-profile">
<span id="index-4"></span><h2>Steps to Enable mClock Profile<a class="headerlink" href="#steps-to-enable-mclock-profile" title="Permalink to this headline">¶</a></h2>
<p>As already mentioned, the default mclock profile is set to <em>high_client_ops</em>.
The other values for the built-in profiles include <em>balanced</em> and
<em>high_recovery_ops</em>.</p>
<p>If there is a requirement to change the default profile, then the option
<a class="reference internal" href="#confval-osd_mclock_profile"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_mclock_profile</span></code></a> may be set during runtime by using the following
command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">ceph config <span class="nb">set</span> osd.N osd_mclock_profile &lt;value&gt;</span>
</pre></div></div></div></blockquote>
<p>For example, to change the profile to allow faster recoveries on “osd.0”, the
following command can be used to switch to the <em>high_recovery_ops</em> profile:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config <span class="nb">set</span> osd.0 osd_mclock_profile high_recovery_ops</span>
</pre></div></div></div></blockquote>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The <em>custom</em> profile is not recommended unless you are an advanced
user.</p>
</div>
<p>And that’s it! You are ready to run workloads on the cluster and check if the
QoS requirements are being met.</p>
</div>
<div class="section" id="osd-capacity-determination-automated">
<h2>OSD Capacity Determination (Automated)<a class="headerlink" href="#osd-capacity-determination-automated" title="Permalink to this headline">¶</a></h2>
<p>The OSD capacity in terms of total IOPS is determined automatically during OSD
initialization. This is achieved by running the OSD bench tool and overriding
the default value of <code class="docutils literal notranslate"><span class="pre">osd_mclock_max_capacity_iops_[hdd,</span> <span class="pre">ssd]</span></code> option
depending on the device type. No other action/input is expected from the user
to set the OSD capacity. You may verify the capacity of an OSD after the
cluster is brought up by using the following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config show osd.N osd_mclock_max_capacity_iops_<span class="o">[</span>hdd, ssd<span class="o">]</span></span>
</pre></div></div></div></blockquote>
<p>For example, the following command shows the max capacity for “osd.0” on a Ceph
node whose underlying device type is SSD:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config show osd.0 osd_mclock_max_capacity_iops_ssd</span>
</pre></div></div></div></blockquote>
</div>
<div class="section" id="steps-to-manually-benchmark-an-osd-optional">
<h2>Steps to Manually Benchmark an OSD (Optional)<a class="headerlink" href="#steps-to-manually-benchmark-an-osd-optional" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>These steps are only necessary if you want to override the OSD
capacity already determined automatically during OSD initialization.
Otherwise, you may skip this section entirely.</p>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>If you have already determined the benchmark data and wish to manually
override the max osd capacity for an OSD, you may skip to section
<a class="reference internal" href="#specifying-max-osd-capacity">Specifying  Max OSD Capacity</a>.</p>
</div>
<p>Any existing benchmarking tool can be used for this purpose. In this case, the
steps use the <em>Ceph OSD Bench</em> command described in the next section. Regardless
of the tool/command used, the steps outlined further below remain the same.</p>
<p>As already described in the <a class="reference internal" href="../osd-config-ref/#dmclock-qos"><span class="std std-ref">基于 mClock 的 QoS</span></a> section, the number of
shards and the bluestore’s throttle parameters have an impact on the mclock op
queues. Therefore, it is critical to set these values carefully in order to
maximize the impact of the mclock scheduler.</p>
<dl class="field-list simple">
<dt class="field-odd">Number of Operational Shards</dt>
<dd class="field-odd"><p>We recommend using the default number of shards as defined by the
configuration options <code class="docutils literal notranslate"><span class="pre">osd_op_num_shards</span></code>, <code class="docutils literal notranslate"><span class="pre">osd_op_num_shards_hdd</span></code>, and
<code class="docutils literal notranslate"><span class="pre">osd_op_num_shards_ssd</span></code>. In general, a lower number of shards will increase
the impact of the mclock queues.</p>
</dd>
<dt class="field-even">Bluestore Throttle Parameters</dt>
<dd class="field-even"><p>We recommend using the default values as defined by
<a class="reference internal" href="../bluestore-config-ref/#confval-bluestore_throttle_bytes"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_throttle_bytes</span></code></a> and
<a class="reference internal" href="../bluestore-config-ref/#confval-bluestore_throttle_deferred_bytes"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_throttle_deferred_bytes</span></code></a>. But these parameters may also be
determined during the benchmarking phase as described below.</p>
</dd>
</dl>
<div class="section" id="osd-bench-command-syntax">
<h3>OSD Bench Command Syntax<a class="headerlink" href="#osd-bench-command-syntax" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference internal" href="../../operations/control/#osd-subsystem"><span class="std std-ref">OSD 子系统</span></a> section describes the OSD bench command. The syntax
used for benchmarking is shown below :</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph tell osd.N bench <span class="o">[</span>TOTAL_BYTES<span class="o">]</span> <span class="o">[</span>BYTES_PER_WRITE<span class="o">]</span> <span class="o">[</span>OBJ_SIZE<span class="o">]</span> <span class="o">[</span>NUM_OBJS<span class="o">]</span></span>
</pre></div></div><p>where,</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">TOTAL_BYTES</span></code>: Total number of bytes to write</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">BYTES_PER_WRITE</span></code>: Block size per write</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">OBJ_SIZE</span></code>: Bytes per object</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">NUM_OBJS</span></code>: Number of objects to write</p></li>
</ul>
</div>
<div class="section" id="benchmarking-test-steps-using-osd-bench">
<h3>Benchmarking Test Steps Using OSD Bench<a class="headerlink" href="#benchmarking-test-steps-using-osd-bench" title="Permalink to this headline">¶</a></h3>
<p>The steps below use the default shards and detail the steps used to determine
the correct bluestore throttle values (optional).</p>
<ol class="arabic">
<li><p>Bring up your Ceph cluster and login to the Ceph node hosting the OSDs that
you wish to benchmark.</p></li>
<li><p>Run a simple 4KiB random write workload on an OSD using the following
commands:</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Note that before running the test, caches must be cleared to get an
accurate measurement.</p>
</div>
<p>For example, if you are running the benchmark test on osd.0, run the following
commands:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph tell osd.0 cache drop</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph tell osd.0 bench <span class="m">12288000</span> <span class="m">4096</span> <span class="m">4194304</span> <span class="m">100</span></span>
</pre></div></div></li>
<li><p>Note the overall throughput(IOPS) obtained from the output of the osd bench
command. This value is the baseline throughput(IOPS) when the default
bluestore throttle options are in effect.</p></li>
<li><p>If the intent is to determine the bluestore throttle values for your
environment, then set the two options, <a class="reference internal" href="../bluestore-config-ref/#confval-bluestore_throttle_bytes"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_throttle_bytes</span></code></a>
and <a class="reference internal" href="../bluestore-config-ref/#confval-bluestore_throttle_deferred_bytes"><code class="xref std std-confval docutils literal notranslate"><span class="pre">bluestore_throttle_deferred_bytes</span></code></a> to 32 KiB(32768 Bytes) each
to begin with. Otherwise, you may skip to the next section.</p></li>
<li><p>Run the 4KiB random write test as before using OSD bench.</p></li>
<li><p>Note the overall throughput from the output and compare the value
against the baseline throughput recorded in step 3.</p></li>
<li><p>If the throughput doesn’t match with the baseline, increment the bluestore
throttle options by 2x and repeat steps 5 through 7 until the obtained
throughput is very close to the baseline value.</p></li>
</ol>
<p>For example, during benchmarking on a machine with NVMe SSDs, a value of 256 KiB
for both bluestore throttle and deferred bytes was determined to maximize the
impact of mclock. For HDDs, the corresponding value was 40 MiB, where the
overall throughput was roughly equal to the baseline throughput. Note that in
general for HDDs, the bluestore throttle values are expected to be higher when
compared to SSDs.</p>
</div>
<div class="section" id="specifying-max-osd-capacity">
<h3>Specifying  Max OSD Capacity<a class="headerlink" href="#specifying-max-osd-capacity" title="Permalink to this headline">¶</a></h3>
<p>The steps in this section may be performed only if you want to override the
max osd capacity automatically set during OSD initialization. The option
<code class="docutils literal notranslate"><span class="pre">osd_mclock_max_capacity_iops_[hdd,</span> <span class="pre">ssd]</span></code> for an OSD can be set by running the
following command:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config <span class="nb">set</span> osd.N osd_mclock_max_capacity_iops_<span class="o">[</span>hdd,ssd<span class="o">]</span> &lt;value&gt;</span>
</pre></div></div></div></blockquote>
<p>For example, the following command sets the max capacity for a specific OSD
(say “osd.0”) whose underlying device type is HDD to 350 IOPS:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config <span class="nb">set</span> osd.0 osd_mclock_max_capacity_iops_hdd <span class="m">350</span></span>
</pre></div></div></div></blockquote>
<p>Alternatively, you may specify the max capacity for OSDs within the Ceph
configuration file under the respective [osd.N] section. See
<a class="reference internal" href="../ceph-conf/#ceph-conf-settings"><span class="std std-ref">配置文件段落</span></a> for more details.</p>
</div>
</div>
<div class="section" id="mclock-config-options">
<span id="index-5"></span><h2>mClock Config Options<a class="headerlink" href="#mclock-config-options" title="Permalink to this headline">¶</a></h2>
<dl class="std confval">
<dt id="confval-osd_mclock_profile">
<code class="sig-name descname"><span class="pre">osd_mclock_profile</span></code><a class="headerlink" href="#confval-osd_mclock_profile" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>This sets the type of mclock profile to use for providing QoS
based on operations belonging to different classes (background
recovery, scrub, snaptrim, client op, osd subop). Once a built-in
profile is enabled, the lower level mclock resource control
parameters [<em>reservation, weight, limit</em>] and some Ceph
configuration parameters are set transparently. Note that the
above does not apply for the <em>custom</em> profile.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">high_client_ops</span></code></p>
</dd>
<dt class="field-odd">valid choices</dt>
<dd class="field-odd"><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">balanced</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">high_recovery_ops</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">high_client_ops</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">custom</span></code></p></li>
</ul>
</dd>
<dt class="field-even">see also</dt>
<dd class="field-even"><p><a class="reference internal" href="../osd-config-ref/#confval-osd_op_queue"><code class="xref std std-confval docutils literal notranslate"><span class="pre">osd_op_queue</span></code></a></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_max_capacity_iops_hdd">
<code class="sig-name descname"><span class="pre">osd_mclock_max_capacity_iops_hdd</span></code><a class="headerlink" href="#confval-osd_mclock_max_capacity_iops_hdd" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Max IOPS capacity (at 4KiB block size) to consider per OSD (for
rotational media)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">315.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_max_capacity_iops_ssd">
<code class="sig-name descname"><span class="pre">osd_mclock_max_capacity_iops_ssd</span></code><a class="headerlink" href="#confval-osd_mclock_max_capacity_iops_ssd" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Max IOPS capacity (at 4KiB block size) to consider per OSD (for solid
state media)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">21500.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_cost_per_io_usec">
<code class="sig-name descname"><span class="pre">osd_mclock_cost_per_io_usec</span></code><a class="headerlink" href="#confval-osd_mclock_cost_per_io_usec" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Cost per IO in microseconds to consider per OSD (overrides _ssd and
_hdd if non-zero)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_cost_per_io_usec_hdd">
<code class="sig-name descname"><span class="pre">osd_mclock_cost_per_io_usec_hdd</span></code><a class="headerlink" href="#confval-osd_mclock_cost_per_io_usec_hdd" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Cost per IO in microseconds to consider per OSD (for rotational media)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">25000.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_cost_per_io_usec_ssd">
<code class="sig-name descname"><span class="pre">osd_mclock_cost_per_io_usec_ssd</span></code><a class="headerlink" href="#confval-osd_mclock_cost_per_io_usec_ssd" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Cost per IO in microseconds to consider per OSD (for solid state
media)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">50.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_cost_per_byte_usec">
<code class="sig-name descname"><span class="pre">osd_mclock_cost_per_byte_usec</span></code><a class="headerlink" href="#confval-osd_mclock_cost_per_byte_usec" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Cost per byte in microseconds to consider per OSD (overrides _ssd and
_hdd if non-zero)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0.0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_cost_per_byte_usec_hdd">
<code class="sig-name descname"><span class="pre">osd_mclock_cost_per_byte_usec_hdd</span></code><a class="headerlink" href="#confval-osd_mclock_cost_per_byte_usec_hdd" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Cost per byte in microseconds to consider per OSD (for rotational
media)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">5.2</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-osd_mclock_cost_per_byte_usec_ssd">
<code class="sig-name descname"><span class="pre">osd_mclock_cost_per_byte_usec_ssd</span></code><a class="headerlink" href="#confval-osd_mclock_cost_per_byte_usec_ssd" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Cost per byte in microseconds to consider per OSD (for solid state
media)</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
</dd>
<dt class="field-even">default</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">0.011</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../bluestore-config-ref/" class="btn btn-neutral float-right" title="BlueStore 配置参考" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../osd-config-ref/" class="btn btn-neutral float-left" title="OSD 配置参考" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>